import numpy as np
from tensorflow import keras
import matplotlib.pyplot as plt
import pandas as pd
from dataset.MIndCsvDatasetAndIndMCV2 import MIndCsvDatasetAndIndMCV2

min_lookup_offset = 20
predict_offset = 1
learning_rate = 0.0002
kernel_initializer = keras.initializers.glorot_normal
activation = keras.activations.sigmoid
min_shape = (min_lookup_offset, 9)
epochs = 100
val_ds_percent = 0.05

## 是否二次训练
print('获取数据集')

min_csv_url = "/Users/aloudata/Downloads/train_data/M999/M999-MIN5-IND.csv"
dataset_reader = MIndCsvDatasetAndIndMCV2(min_csv=min_csv_url,
                                          predict_offset=predict_offset,
                                          min_lookup=min_lookup_offset,
                                          up_down_scale=1)
min_dataset, target_dataset = dataset_reader.read_min(normalization=True,
                                                      # ds_cnt=10000,
                                                      start_code="M2005"
                                                      )

total_cnt = len(min_dataset)
val_cnt = int(total_cnt * val_ds_percent)
train_cnt = total_cnt - val_cnt

train_min_ds = min_dataset[0:train_cnt]
train_target_ds = target_dataset[0:train_cnt]

val_min_ds = min_dataset[train_cnt:]
val_target_ds = target_dataset[train_cnt:]
